package br.com.hs.biosys.model.domain;

import br.com.hs.biosys.model.domain.generics.GenericDomain;
import javax.persistence.*;

/**
 * Establishment.class
 *
 * @author Ranlive Hrysyk
 * @since 19/07/2012
 */
@Entity
@Table(name = "\"Establishment\"")
public class Establishment extends GenericDomain {

    private static final long serialVersionUID = 1L;
    // *********************** PROPERTIES *********************************** //
    public static final String PROPERTY_ID = "establishmentID";
    public static final String PROPERTY_NAME = "name";
    // ********************************************************************** //
    /**
     * ID da entidade. Auto gerado.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "\"EstablishmentID\"", nullable = false, updatable = false)
    private Long establishmentID;
    /**
     * Nome. Tamanho 50. Não nulo.
     */
    @Column(name = "\"Name\"", nullable = false, length = 50)
    private String name;
    /**
     * Endereço.
     */
    @ManyToOne
    @JoinColumn(name = "\"AddressID\"")
    private Address address;

    /**
     * Constructor default.
     */
    public Establishment() {
    }

    /**
     * Constructor with identity.
     *
     * @param establishmentID the id
     */
    public Establishment(Long establishmentID) {
        this.establishmentID = establishmentID;
    }

    /**
     * ID da entidade. Auto gerado.
     *
     * @return the establishmentID
     */
    public Long getEstablishmentID() {
        return establishmentID;
    }

    /**
     * Nome. Tamanho 50. Não nulo.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Nome da entidade. Tamanho 50. Não nulo.
     *
     * @param name the name to set
     */
    public void setName(String name) {
        this.firePropertyChange(PROPERTY_NAME, this.name, this.name = name);
    }

    /**
     * Endereço.
     *
     * @return the address
     */
    public Address getAddress() {
        return address;
    }

    /**
     * Endereço.
     *
     * @param address the address to set
     */
    public void setAddress(Address address) {
        this.address = address;
    }
}